/*
 *  $Id: NagaOracle.cs 1053 2010-05-19 10:05:23Z thenn.erannor $
 *  This file is a part of Ragima CCG.
 *  (C) 2008 Ragima development group.
 *
 *  Licensed under the terms of the GNU GPL License version 2.
 *
 */

namespace Ragima.Cards001.Earth.Creatures {
    public class NagaOracle: CreatureCard {
        public NagaOracle(): base("001_e_c_naga_oracle") {
            Level = CompleteLevel.ReadyForTest;
            Element = ElementType.Earth;
            Value = 100;
            SetRace<Races.Naga>();
            Damage = 2;
            Health = 5;
            AddManaCost(ElementType.Earth, 5);
        }
        public override void SetNaturalAffects(ICollector<Affect> affects) {
            affects.Add(new Affects.VenomAttack(1));
            affects.Add<NagaOracleAffect>();
        }

        private class NagaOracleAffect: Affect, IManaCostChanger {
            public override string Id {
                get { return AffectManager.GetCardId<NagaOracle>("aura"); }
            }

            public override void SetAffect() {
                base.SetAffect();
                GlobalSummary.ManaChangers.Add(this);
                EnemySummary.ManaChangers.Add(this);
            }
            public override void ResetAffect() {
                base.ResetAffect();
                GlobalSummary.ManaChangers.Remove(this);
                EnemySummary.ManaChangers.Remove(this);
            }

            int IPrioritized.Priority {
                get { return 0; }
            }
            bool IManaCostChanger.Accept(Player player, Card card, ElementValues manas) {
                CreatureCard cr = card as CreatureCard;
                return cr != null && cr.Race.IsRace<Races.Naga>();
            }
            void IManaCostChanger.Change(Player player, Card card, ElementValues manas) {
                if (manas[ElementType.Earth] > 1)
                    manas.Decrement(ElementType.Earth);
            }
        }
    }
}
